/*
 * Name: Joon Ho Cho
 * Date: 10/24/2008
 * Course: 15-437
 */
package scheduler.formbean;

import java.util.ArrayList;
import java.util.List;

public class AddForm {
	private String course = "";
	private int courseNumber;
	private String Section="A";
	private boolean submit=false;
	
	/*public String getCourse() {
        return course;
    }
    */

    public void setCourse(String Course) {
        this.course = Course;
        if(course.length()!=0)
        {
        	System.out.println("sfsdfsdsfsdsdfsdfsdfsdsdf" +course.length());
        	submit=true;
        }
        if(course.length()>5)
        {
        	try{
        		courseNumber=Integer.parseInt(course.substring(0, 5));	
        		Section=course.substring(5).toUpperCase();
    		}
    		catch(Exception e){    			
    			
    		}       	
        	
        }
        else if(course.length()==5){
        	try{
        		courseNumber=Integer.parseInt(course);    			
    		}
    		catch(Exception e){    			
    			
    		}
        	
        	
        }
    }

    public String getSection() {
        return Section;
    }

    public int getCourseNumber() {
        return courseNumber;
    }
    
    public List<String> getValidationErrors() {
		List<String> errors = new ArrayList<String>();

		/*if (name == null || name.length() == 0) {
			errors.add("Bookmark name is required.");
		}
		
		if (url == null || url.length() == 0) {
			errors.add("URL is required.");
		}*/
		
		return errors;
	}
	
	public boolean submitted() {
		return submit;
	}
}
